<template>
	<el-form :model="form" label-width="auto" style="max-width: 600px">
		<el-form-item label="Activity name">
			<el-input v-model="form.name" />
		</el-form-item>
		<el-form-item label="Activity zone">
			<el-select v-model="form.region" placeholder="please select your zone">
				<el-option label="Zone one" value="shanghai" />
				<el-option label="Zone two" value="beijing" />
			</el-select>
		</el-form-item>
		<el-form-item label="Instant delivery">
			<el-switch v-model="form.delivery" />
		</el-form-item>
		<el-form-item label="Activity type">
			<el-checkbox-group v-model="form.type">
				<el-checkbox value="Online activities" name="type"> Online activities </el-checkbox>
				<el-checkbox value="Promotion activities" name="type"> Promotion activities </el-checkbox>
				<el-checkbox value="Offline activities" name="type"> Offline activities </el-checkbox>
				<el-checkbox value="Simple brand exposure" name="type"> Simple brand exposure </el-checkbox>
			</el-checkbox-group>
		</el-form-item>
		<el-form-item label="Resources">
			<el-radio-group v-model="form.resource">
				<el-radio value="Sponsor">Sponsor</el-radio>
				<el-radio value="Venue">Venue</el-radio>
			</el-radio-group>
		</el-form-item>
		<el-form-item label="Activity form">
			<el-input v-model="form.desc" type="textarea" />
		</el-form-item>
	</el-form>
</template>

<script lang="ts" setup>
import { reactive } from 'vue'

// do not use same name with ref
const form = reactive({
	name: '',
	region: '',
	delivery: false,
	type: [],
	resource: '',
	desc: ''
})
const getData = () => {
	return form
}

defineExpose({
	// 把数据暴露给父节点使用
	getData
})
</script>
